home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
9-Digit Zip Code Directory
/
9-Digit Zip Code Directory (American Business Information) (ABIZIP-12).ISO
/
z4src.zip
/
BSPRTSCR.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-09-10
|
5KB
|
164 lines
//----------------------------------------------------------------------------
// MODULE DESCRIPTION
//
// Module: bsprtscr.c
// Title: Base library
// Notice: John M. Weeder
// Copyright (c) 1993. All rights reserved.
// This module contains proprietary information and should be
// treated as confidential.
//
//----------------------------------------------------------------------------
// MAINTENANCE HISTORY
//
// $Workfile$
// $Revision$
// $Author$
// $Date$
// $Log$
//
//----------------------------------------------------------------------------
// MODULE NARRATIVE
//
//
// This module contains code to enable and disable <Print Screen>
// functionality. It contains an interrupt service routine for interrupt 5.
// This ISR does not do anything.
//
//
// I haven't tested it, but the following method can also be used to enable
// and disable print screens:
//
// if (turn_on)
// pokeb(0x0050, 0x0000, 0);
// else
// pokeb(0x0050, 0x0000, 1);
//
//
// The code in this module should be written entirely in C.
// Do not use any C++ constructs.
//
// This module is portable to:
// DOS 3.X+
// MS Windows 3.X+
// OS/2 2.X+
// OS/2 2.0 PM
// SCO UNIX.
//
// The following compilers are supported:
// MSC 6.0A
// MSC/C++ 7.0
// Borland C++ 3.1 for DOS
// Borland C++ 1.0 for OS/2 2.X
// SCO UNIX cc
//
//----------------------------------------------------------------------------
//
// The print screen can also be turned off by using these calls:
//
// if (turn_on)
// pokeb(0x0050, 0x0000, 0);
// else
// pokeb(0x0050, 0x0000, 1);
//
//----------------------------------------------------------------------------
#include <bs.h>
#if OS_DOS && COMPILER_BORLAND
//----------------------------------------------------------------------------
// Globals
//----------------------------------------------------------------------------
static void _interrupt (*oldint5)(void);
//----------------------------------------------------------------------------
// Description: New interrupt handler for INT 5 (print screen)
// Parameters:
// Returns:
//----------------------------------------------------------------------------
void _interrupt new_int_5(void)
{
// Do nothing!!
return ;
}
//----------------------------------------------------------------------------
// Description: Re-install previous print screen handler.
// Parameters:
// Returns:
//----------------------------------------------------------------------------
VOID FN_E PrintScreenTerminate(void)
{
if (oldint5) // Uninstall new
{
Assert(oldint5 == _dos_getvect(5));
_dos_setvect(5,oldint5);
oldint5 = NULL;
}
return ;
}
#endif // #if OS_DOS && COMPILER_BORLAND
//----------------------------------------------------------------------------
// Description: Enable and disable print screen.
// Parameters: fDisable If true, print screen is disabled.
// Returns:
//----------------------------------------------------------------------------
VOID FN_E PrintScreen(BOOL fDisable)
{
#if OS_DOS && COMPILER_BORLAND
if (fDisable)
{
if (oldint5 == NULL)
{
oldint5 = _dos_getvect(5);
_dos_setvect(5,new_int_5);
BaseExitFunc((PFNEXIT)PrintScreenTerminate, SYS_EXIT_PRIORITY);
}
}
else
PrintScreenTerminate();
#else
NOTUSED(fDisable);
#endif
return ;
}
//----------------------------------------------------------------------------
// Description: Run standard test suite
// Parameters: sTest Test to run.
// 0 Run all default tests (except).
// Returns: TRUE if successful.
//----------------------------------------------------------------------------
#if COMPILE_TEST
BOOL FN PrintScreenTest(SHORT sTest)
{
NOTUSED(sTest);
#if OS_DOS && COMPILER_BORLAND
KbdFlush();
PrintScreen(TRUE);
Output("Print screen is disabled.\nPress any key to continue.\n");
while (!KbdReady())
;
KbdChar();
PrintScreen(FALSE);
Output("Print screen is enabled.\n");
#else
Output("This test is only valid under DOS\n");
#endif
return TRUE;
}
#endif
//----------------------------------------------------------------------------
//------------------------------- End of File --------------------------------
//----------------------------------------------------------------------------